package com.java.admin.controller;

import com.github.pagehelper.PageInfo;
import com.java.admin.service.AdminService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.List;
import java.util.Map;

/**
 * @Description: 用户
 * @ClassName: AdminController
 * @Author: 顾元伟
 * @Date: 2021/7/13
 * @Version: 1.0
 */
@Controller
@RequestMapping("/admin")
public class AdminController {

    @Autowired
    private AdminService adminService;

    @RequestMapping("/test")
    public @ResponseBody String test(){
        return "hello sm";
    }

    @RequestMapping("/getAdminInfo")
    @ResponseBody
    public List<Map<String,Object>> getAdminInfo(Integer pageNum, Integer pageSize){
        List<Map<String, Object>> bookList = adminService.getAdminInfo(pageNum, pageSize);
        PageInfo<Map<String, Object>> pageInfo = new PageInfo<>(bookList);
        return pageInfo.getList();
    }
}
